import numpy as np
import cv2
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

data = cv2.imread("...")
w = data.shape[1]
h = data.shape[0]

fig = plt.figure()
ax = Axes3D(fig)
ax.set_xlim(0, h-1)
ax.set_ylim(0, w-1)
ax.set_zlim(0, 20)

ax.set_zlabel('Z', fontdict={'size': 15, 'color': 'red'})
ax.set_ylabel('Y', fontdict={'size': 15, 'color': 'red'})
ax.set_xlabel('X', fontdict={'size': 15, 'color': 'red'})

for x in range(0, h, 50):
    for y in range(0, w, 50):
        z = np.random.randint(0,20,size=(1))[0]
        tmp_list = list(data[x,y]/255.0)
        tmp_list.reverse()
        ax.scatter(x, y, z, c=[tmp_list], marker='.',s=2,linewidth=1)

plt.show()
